package com.yc.hwc.dao;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.yc.hwc.bean.User;

public interface IUserExDao extends IUserDao{

	@Query("from User a"
			+ " where (a.account=:#{#user.account}"
			+ " or a.name=:#{#user.account}"
			+ " or a.email=:#{#user.account}"
			+ " or a.phone=:#{#user.account})"
			+ " and a.pwd=:#{#user.pwd}")
	User findForLogin(@Param("user") User user);

	int countByAccountAndIdNot(String account, Long id);

	int countByEmailAndIdNot(String email, Long id);

	User getByAccountOrEmail(String account, String email);
	
}
